
use "../2_Data/temp/data_selected_region.dta", clear

sort region date

levelsof codice_regione, local(prov)


foreach province in `prov' {
    
	gen trend_prov`province'= (codice_regione==`province')*trend
}

la var post_election "Post $\times$ Campaign"
la var totale_casi "Cases"
la var deceduti "Deaths"
la var terapia "ICU"
la var totale_osp "Hosp."
la var tamponi "Tests"
la var daily_increase "Cases"
la var deceduti_day "Deaths"
la var tamponi_day "Tests"
la var ratio2 "\% Positive"

global tab_name table_weight_regional_boundary_trend

local trends trend_prov1 trend_prov3 trend_prov5 trend_prov8 trend_prov10 trend_prov11 trend_prov12 trend_prov14 trend_prov16 trend_prov18 trend_prov19


reg2hdfespatial daily_increase post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_daily_increase if election==1 & post==0

reg2hdfespatial tamponi_day post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_tamponi_day if election==1 & post==0

reg2hdfespatial ratio2 post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_ratio2 if election==1 & post==0

reg2hdfespatial totale_osp post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_totale_osp if election==1 & post==0

reg2hdfespatial terapia post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_terapia if election==1 & post==0

reg2hdfespatial deceduti_day post_election `trends', lat(x_region) lon(y_region) timevar(time_fe_region) panelvar(region_code) distcutoff(1300) lagcutoff(110) 
sum number_deceduti_day if election==1 & post==0
